﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #nullable disable

namespace DataWasher.WebApi.EntitiesSQLServer
{
    public partial class SqlServerDBContext : DbContext
    {
        public SqlServerDBContext()
        {
        }

        public SqlServerDBContext(DbContextOptions<SqlServerDBContext> options)
            : base(options)
        {
        }

        public virtual DbSet<BaseBrandInfo> BaseBrandInfo { get; set; }
        public virtual DbSet<BaseStoreInfo> BaseStoreInfo { get; set; }
        public virtual DbSet<BaseStoreTag> BaseStoreTag { get; set; }
        public virtual DbSet<BaseStoreTagRelation> BaseStoreTagRelation { get; set; }
        public virtual DbSet<BaseStoreType> BaseStoreType { get; set; }
        public virtual DbSet<SysDomain> SysDomain { get; set; }
        public virtual DbSet<SysDomainInfo> SysDomainInfo { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseSqlServer("Server=tcp:rplustestdb.database.windows.net,1433; Database=testfordashboard;Persist Security Info=True;User ID=testuser;password=1qaz2wsx#EDC;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<BaseBrandInfo>(entity =>
            {
                entity.HasKey(e => e.BrandInfoId)
                    .HasName("PK_dbo.Base_BrandInfo");

                entity.ToTable("Base_BrandInfo");

                entity.Property(e => e.BrandInfoId)
                    .HasComment("品牌ID")
                    .ValueGeneratedNever();

                entity.Property(e => e.AddDate)
                    .HasColumnType("datetime")
                    .HasComment("添加日期");

                entity.Property(e => e.BrandCode)
                    .HasMaxLength(20)
                    .HasComment("品牌编号");

                entity.Property(e => e.BrandNameCn)
                    .HasMaxLength(200)
                    .HasComment("品牌中文名称");

                entity.Property(e => e.BrandNameEn)
                    .HasMaxLength(200)
                    .HasComment("品牌英文名称");

                entity.Property(e => e.BrandTypeId).HasComment("品牌类型ID");

                entity.Property(e => e.CancelDate)
                    .HasColumnType("datetime")
                    .HasComment("取消日期");

                entity.Property(e => e.CorpId)
                    .HasMaxLength(512)
                    .IsUnicode(false);

                entity.Property(e => e.Description).HasComment("备注");

                entity.Property(e => e.IsDeleted).HasComment("是否删除");

                entity.Property(e => e.IsValid).HasComment("是否有效");

                entity.Property(e => e.OwnerId).HasComment("甲方ID");

                entity.Property(e => e.SortNo).HasDefaultValueSql("((0))");

                entity.Property(e => e.UpdateDate)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");
            });

            modelBuilder.Entity<BaseStoreInfo>(entity =>
            {
                entity.HasKey(e => e.StoreId)
                    .HasName("PK_dbo.Base_StoreInfo");

                entity.ToTable("Base_StoreInfo");

                entity.Property(e => e.StoreId)
                    .HasComment("店铺ID")
                    .ValueGeneratedNever();

                entity.Property(e => e.AddDate)
                    .HasColumnType("datetime")
                    .HasComment("添加日期");

                entity.Property(e => e.AreaSquare).HasComment("面积 平方");

                entity.Property(e => e.Blueprint).HasMaxLength(500);

                entity.Property(e => e.BrandInfoId).HasComment("品牌ID");

                entity.Property(e => e.CancelDate)
                    .HasColumnType("datetime")
                    .HasComment("取消日期");

                entity.Property(e => e.City)
                    .HasMaxLength(200)
                    .HasComment("城市????");

                entity.Property(e => e.CloseDate).HasColumnType("datetime");

                entity.Property(e => e.Contact)
                    .HasMaxLength(200)
                    .HasComment("联系人");

                entity.Property(e => e.ContactId).HasComment("联系人ID?????");

                entity.Property(e => e.ContactName)
                    .HasMaxLength(50)
                    .HasComment("联系人姓名?????");

                entity.Property(e => e.ContactPhone)
                    .HasMaxLength(200)
                    .HasComment("联系人电话");

                entity.Property(e => e.CorpId)
                    .HasMaxLength(512)
                    .IsUnicode(false);

                entity.Property(e => e.Country).HasComment("所在国家");

                entity.Property(e => e.CurrencyId).HasComment("货币Id");

                entity.Property(e => e.DealerId).HasComment("经销商ID");

                entity.Property(e => e.DecorationDate)
                    .HasColumnType("datetime")
                    .HasComment("装饰日期");

                entity.Property(e => e.Description)
                    .HasColumnName("DESCRIPTION")
                    .HasMaxLength(200)
                    .HasComment("备注");

                entity.Property(e => e.DistrictId).HasComment("国家地区ID");

                entity.Property(e => e.DistrictName)
                    .HasMaxLength(500)
                    .HasComment("区域名称");

                entity.Property(e => e.DomainId).HasComment("组织ID");

                entity.Property(e => e.DomainNo)
                    .HasMaxLength(200)
                    .HasDefaultValueSql("('')")
                    .HasComment("组织No");

                entity.Property(e => e.Gpsaddress)
                    .HasColumnName("GPSAddress")
                    .HasMaxLength(500)
                    .HasDefaultValueSql("('')")
                    .HasComment("GPS定位地址");

                entity.Property(e => e.IsDeleted).HasComment("是否删除");

                entity.Property(e => e.IsPerfect).HasComment("信息是否完全");

                entity.Property(e => e.IsValid).HasComment("是否有效");

                entity.Property(e => e.Level).HasMaxLength(50);

                entity.Property(e => e.MaintenanceMemo)
                    .HasMaxLength(500)
                    .HasComment("维修名称????");

                entity.Property(e => e.ManageType).HasComment("经营方式（0:直营 1:经销）");

                entity.Property(e => e.Market)
                    .HasMaxLength(400)
                    .HasComment("市场");

                entity.Property(e => e.MntMallCertificate)
                    .HasMaxLength(200)
                    .HasComment("店铺维修证书");

                entity.Property(e => e.MntTime)
                    .HasMaxLength(200)
                    .HasComment("维修时间");

                entity.Property(e => e.OpenDate)
                    .HasColumnType("datetime")
                    .HasComment("开店日期");

                entity.Property(e => e.PersonInCharge)
                    .HasMaxLength(200)
                    .HasComment("负责人????");

                entity.Property(e => e.ProvinceId).HasComment("区域ID");

                entity.Property(e => e.RefCode)
                    .HasMaxLength(50)
                    .HasComment("引用编号???");

                entity.Property(e => e.Remark)
                    .HasMaxLength(500)
                    .HasComment("备注");

                entity.Property(e => e.Reserved01Str).HasColumnName("Reserved01_Str");

                entity.Property(e => e.Reserved02Str).HasColumnName("Reserved02_Str");

                entity.Property(e => e.Reserved03Str).HasColumnName("Reserved03_Str");

                entity.Property(e => e.Reserved04Str).HasColumnName("Reserved04_Str");

                entity.Property(e => e.Reserved05Str).HasColumnName("Reserved05_Str");

                entity.Property(e => e.Reserved06Str).HasColumnName("Reserved06_Str");

                entity.Property(e => e.Reserved07Str).HasColumnName("Reserved07_Str");

                entity.Property(e => e.Reserved08Str).HasColumnName("Reserved08_Str");

                entity.Property(e => e.Reserved09Str).HasColumnName("Reserved09_Str");

                entity.Property(e => e.Reserved10Str)
                    .HasColumnName("Reserved10_Str")
                    .HasComment("备用字段::::::::");

                entity.Property(e => e.Reserved11Num)
                    .HasColumnName("Reserved11_Num")
                    .HasColumnType("decimal(18, 2)");

                entity.Property(e => e.Reserved12Num)
                    .HasColumnName("Reserved12_Num")
                    .HasColumnType("decimal(18, 2)");

                entity.Property(e => e.Reserved13Num)
                    .HasColumnName("Reserved13_Num")
                    .HasColumnType("decimal(18, 2)");

                entity.Property(e => e.Reserved14Num)
                    .HasColumnName("Reserved14_Num")
                    .HasColumnType("decimal(18, 2)");

                entity.Property(e => e.Reserved15Num)
                    .HasColumnName("Reserved15_Num")
                    .HasColumnType("decimal(18, 2)");

                entity.Property(e => e.Reserved16Date)
                    .HasColumnName("Reserved16_Date")
                    .HasColumnType("date");

                entity.Property(e => e.Reserved17Date)
                    .HasColumnName("Reserved17_Date")
                    .HasColumnType("date");

                entity.Property(e => e.Reserved18Date)
                    .HasColumnName("Reserved18_Date")
                    .HasColumnType("date");

                entity.Property(e => e.Reserved19Date)
                    .HasColumnName("Reserved19_Date")
                    .HasColumnType("date");

                entity.Property(e => e.Reserved20Date)
                    .HasColumnName("Reserved20_Date")
                    .HasColumnType("date");

                entity.Property(e => e.StoreAbbName)
                    .HasMaxLength(200)
                    .HasComment("店铺简称");

                entity.Property(e => e.StoreAddress)
                    .HasMaxLength(300)
                    .HasComment("店铺地址");

                entity.Property(e => e.StoreCode)
                    .HasMaxLength(12)
                    .HasComment("店铺编号");

                entity.Property(e => e.StoreEmail)
                    .HasMaxLength(200)
                    .HasComment("店铺邮箱");

                entity.Property(e => e.StoreEndTime)
                    .HasMaxLength(200)
                    .HasComment("店铺结束时间");

                entity.Property(e => e.StoreFax)
                    .HasMaxLength(20)
                    .HasComment("店铺传真");

                entity.Property(e => e.StoreLang)
                    .HasDefaultValueSql("((0))")
                    .HasComment("店铺语言");

                entity.Property(e => e.StoreName)
                    .HasMaxLength(200)
                    .HasComment("店铺名称");

                entity.Property(e => e.StoreNameEn)
                    .HasColumnName("StoreNameEN")
                    .HasMaxLength(200)
                    .HasComment("店铺英文名称????");

                entity.Property(e => e.StorePhone)
                    .HasMaxLength(200)
                    .HasComment("店铺电话号码");

                entity.Property(e => e.StorePostCode)
                    .HasMaxLength(10)
                    .HasComment("店铺邮编");

                entity.Property(e => e.StoreRules)
                    .HasMaxLength(200)
                    .HasComment("店铺规则");

                entity.Property(e => e.StoreStartTime)
                    .HasMaxLength(200)
                    .HasComment("店铺开始时间");

                entity.Property(e => e.StoreThumbnail).HasMaxLength(500);

                entity.Property(e => e.StoreTypeId).HasComment("店铺类型ID");

                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
            });

            modelBuilder.Entity<BaseStoreTag>(entity =>
            {
                entity.HasKey(e => e.StoreTagId);

                entity.ToTable("Base_StoreTag");

                entity.Property(e => e.StoreTagId)
                    .HasComment("店铺标签ID")
                    .ValueGeneratedNever();

                entity.Property(e => e.AddDate).HasColumnType("datetime");

                entity.Property(e => e.AddUserId).HasComment("添加人ID");

                entity.Property(e => e.OwnerId).HasComment("公司ID");

                entity.Property(e => e.TagName)
                    .IsRequired()
                    .HasMaxLength(50)
                    .HasComment("店铺标签名称");

                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
            });

            modelBuilder.Entity<BaseStoreTagRelation>(entity =>
            {
                entity.HasKey(e => e.StoreTagRelationId);

                entity.ToTable("Base_StoreTagRelation");

                entity.Property(e => e.StoreTagRelationId)
                    .HasComment("店铺与标签关系ID")
                    .ValueGeneratedNever();

                entity.Property(e => e.AddDate).HasColumnType("datetime");

                entity.Property(e => e.StoreId).HasComment("店铺ID");

                entity.Property(e => e.StoreTagId).HasComment("店铺标签ID");
            });

            modelBuilder.Entity<BaseStoreType>(entity =>
            {
                entity.HasKey(e => e.StoreTypeId)
                    .HasName("PK_dbo.Base_StoreType");

                entity.ToTable("Base_StoreType");

                entity.Property(e => e.StoreTypeId)
                    .HasComment("店铺类型ID")
                    .ValueGeneratedNever();

                entity.Property(e => e.AddDate)
                    .HasColumnType("datetime")
                    .HasComment("添加日期");

                entity.Property(e => e.IsDeleted).HasComment("是否删除");

                entity.Property(e => e.OwnerId).HasComment("公司ID");

                entity.Property(e => e.TypeCode)
                    .HasMaxLength(20)
                    .HasComment("店铺类型编号");

                entity.Property(e => e.TypeName)
                    .HasMaxLength(50)
                    .HasComment("店铺类型名称");

                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
            });

            modelBuilder.Entity<SysDomain>(entity =>
            {
                entity.HasKey(e => e.DomainId);

                entity.ToTable("Sys_Domain");

                entity.Property(e => e.DomainId)
                    .HasComment("组织ID")
                    .ValueGeneratedNever();

                entity.Property(e => e.AddDate)
                    .HasColumnType("datetime")
                    .HasComment("添加日期");

                entity.Property(e => e.Address)
                    .HasMaxLength(500)
                    .HasComment("地址???");

                entity.Property(e => e.AuthStatus).HasComment("0：非微信用户  1：微信绑定");

                entity.Property(e => e.ContactEmail)
                    .HasMaxLength(100)
                    .HasComment("联系邮箱????");

                entity.Property(e => e.ContactId).HasComment("联系人ID???");

                entity.Property(e => e.ContactName)
                    .HasMaxLength(50)
                    .HasComment("联系人名称???");

                entity.Property(e => e.ContactPhone)
                    .HasMaxLength(20)
                    .HasComment("联系人电话");

                entity.Property(e => e.CorpId)
                    .HasMaxLength(512)
                    .IsUnicode(false);

                entity.Property(e => e.Description)
                    .HasMaxLength(300)
                    .HasComment("组织描述");

                entity.Property(e => e.DomainCode).HasComment("组织编号");

                entity.Property(e => e.DomainName).HasComment("组织名称");

                entity.Property(e => e.DomainNo)
                    .HasMaxLength(200)
                    .HasComment("组织No");

                entity.Property(e => e.DomainTag).HasComment("组织标签");

                entity.Property(e => e.DomainTypeId).HasComment("组织类型ID");

                entity.Property(e => e.IsDeleted).HasComment("是否删除");

                entity.Property(e => e.IsSyncParent)
                    .IsRequired()
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Owner).HasComment("甲方");

                entity.Property(e => e.OwnerId).HasComment("甲方ID");

                entity.Property(e => e.ParentDomainId).HasComment("父类ID");

                entity.Property(e => e.PersonInCharge)
                    .HasMaxLength(50)
                    .HasComment("负责人????");

                entity.Property(e => e.PostCode)
                    .HasMaxLength(10)
                    .HasComment("邮编????");

                entity.Property(e => e.RefCode)
                    .HasMaxLength(50)
                    .HasComment("??????");

                entity.Property(e => e.Reserved01).HasMaxLength(500);

                entity.Property(e => e.Reserved02).HasMaxLength(500);

                entity.Property(e => e.Reserved03).HasMaxLength(500);

                entity.Property(e => e.Reserved04).HasMaxLength(500);

                entity.Property(e => e.Reserved05).HasMaxLength(500);

                entity.Property(e => e.Reserved06).HasMaxLength(500);

                entity.Property(e => e.Reserved07).HasColumnType("decimal(18, 0)");

                entity.Property(e => e.Reserved08).HasColumnType("decimal(18, 0)");

                entity.Property(e => e.Reserved09).HasColumnType("date");

                entity.Property(e => e.Reserved10).HasColumnType("date");

                entity.Property(e => e.SortNo).HasDefaultValueSql("((0))");

                entity.Property(e => e.Status).HasComment("系统状态");

                entity.Property(e => e.UpdateDate)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");
            });

            modelBuilder.Entity<SysDomainInfo>(entity =>
            {
                entity.HasKey(e => e.DomainInfoId)
                    .HasName("PK_dbo.Sys_DomainInfo");

                entity.ToTable("Sys_DomainInfo");

                entity.Property(e => e.DomainInfoId)
                    .HasComment("自定义ID")
                    .ValueGeneratedNever();

                entity.Property(e => e.AddDate)
                    .HasColumnType("datetime")
                    .HasComment("添加日期");

                entity.Property(e => e.Description).HasComment("自定义描述");

                entity.Property(e => e.DomainName)
                    .HasMaxLength(50)
                    .HasComment("自定义名称");

                entity.Property(e => e.DomainTypeId).HasComment("组织类型ID");

                entity.Property(e => e.IsDeleted).HasComment("是否删除");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
